package cn.iocoder.yudao.module.lfd.dal.mysql.points;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.lfd.dal.dataobject.points.PointsDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.lfd.controller.admin.points.vo.*;

/**
 * 积分 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PointsMapper extends BaseMapperX<PointsDO> {

    default PageResult<PointsDO> selectPage(PointsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PointsDO>()
                .eqIfPresent(PointsDO::getType, reqVO.getType())
                .eqIfPresent(PointsDO::getAmount, reqVO.getAmount())
                .betweenIfPresent(PointsDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PointsDO::getOpenid, reqVO.getOpenid())
                .eqIfPresent(PointsDO::getAppointmentId, reqVO.getAppointmentId())
                .orderByDesc(PointsDO::getId));
    }

    default List<PointsDO> selectList(PointsExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<PointsDO>()
                .eqIfPresent(PointsDO::getType, reqVO.getType())
                .eqIfPresent(PointsDO::getAmount, reqVO.getAmount())
                .betweenIfPresent(PointsDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PointsDO::getOpenid, reqVO.getOpenid())
                .eqIfPresent(PointsDO::getAppointmentId, reqVO.getAppointmentId())
                .orderByDesc(PointsDO::getId));
    }

}
